const mongoose = require('mongoose')
const Scheme = mongoose.Schema
mongoose.connect('mongodb://localhost/code_order')

const menuSchema = new Scheme({
  title: {  //名称
    type: String,
    required: true
  },
  parentId: {  //分类id
    type: String,
    required: true
  },
  price: {  //价格
    type: Number,
    required: true,
    default: 10
  },
  details: {  //详情
    type: String
  },
  thumb: {  //图片
    type: String,
  },
  recommend: {  //推荐
    type: Boolean,
    default: false
  }
})

const Menu = mongoose.model('menu', menuSchema)
module.exports = Menu
